package com.itxx.allTools.homeWork;

import java.lang.reflect.Array;
import java.util.Arrays;

public class SystemHomeWork {
    public static void main(String[] args) {
        /*有以下数组：
        int[] arr = {10,27,8,5,2,1,3,55,88};
        请定义一个新数组，长度为5，并将arr中几个连续的1位数的数字复制到新数组。

*/
        int[] arr = {10, 27, 8, 5, 2, 1, 3, 55, 88};
        int[] newarr = new int[5];
        System.arraycopy(arr, 2, newarr, 0, newarr.length);
        System.out.println(Arrays.toString(newarr));
        /*有以下数组：
        int[] arr = {55,77,0,88,22,44,33};
        请编程实现：将后四个数字依次前移一位，移动后，最后一位置为0.*/
        int[] arr1 = {55,77,0,88,22,44,33};
        int [] arr2 = new int[7];
        System.arraycopy(arr1, 0, arr2, 0, 2);
        System.arraycopy(arr1, 3, arr2, 2, 4);
        System.arraycopy(arr1, 2, arr2, arr2.length-1, 1);
        System.out.println(Arrays.toString(arr2));




    }
}
